
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<title>信封创建页面</title>
<%
    HttpSession session1 = request.getSession();
    if(session1==null || session1.getAttribute("id")==null){
        response.sendRedirect(request.getContextPath()+"/index.jsp");
    }
%>

<p>创建信封</p><br>
<form action="<%=request.getContextPath()%>/function/envelope" method="post">
    信封名字<input type="text" name="envelope_name" placeholder="长度为2-20,不能含有特殊字符"><br>
    信封状态：<input type="radio" name="state" value="open" checked="checked">公开
    <input type="radio" name="state" value="close">私密<br>
    <input type="submit" value="提交数据" onclick="return judgment()">
</form>

<script>
    const reg = /^\s*$/g;
    function judgment(){
        const name = document.getElementById("envelope_name").value;

        if(!reg.test(name)){
            alert("不能为空");
            return false;
        }
        return true;
    }
</script>
<a href="<%=request.getContextPath()%>/function/myEnvelope">返回我的信封</a>
<style>
    body {
        background-image: url("../picture/new.jpg");
        background-repeat: no-repeat;
        background-attachment: fixed;
        background-position: center center;
        background-size: 100% 100%;
    }
</style>